home *** CD-ROM | disk | FTP | other *** search
/ The Fatted Calf / The Fatted Calf.iso / Modules / BackSpaceModules / Source / AquariumView / Aquarium.m < prev    next >
Text File  |  1993-03-12  |  1KB  |  86 lines

  1. #import "Aquarium.h"
  2. #import "Fish.h"
  3. #ifndef NS3x
  4. #import "Thinker.h"
  5. #else
  6. #import "Thinker3.h"
  7. #endif
  8. #import <libc.h>
  9. #import <objc/List.h>
  10. #import <dpsclient/wraps.h>
  11.  
  12. #define NUM_OF_FISH 8
  13.  
  14. @implementation AquariumView
  15.  
  16. - oneStep
  17. {
  18.     [fishList makeObjectsPerform:@selector(move:) with:fishList];
  19.     return self;
  20. }
  21.  
  22. - initFrame:(NXRect *)frameRect
  23. {
  24.     int x;
  25.  
  26.     [super initFrame:frameRect];
  27.     fishList = [[List allocFromZone:[self zone]] init];
  28.     for (x=0;x<NUM_OF_FISH;x++)
  29.         [fishList addObject:[[Fish allocFromZone:[self zone]] init:self]];
  30.  
  31.     return self;
  32. }
  33.  
  34. - drawSelf:(const NXRect *)rects :(int)rectCount 
  35. {
  36.     if (!rects || !rectCount) return self;
  37.  
  38.     PSsetgray(NX_BLACK);
  39.     NXRectFill(rects);
  40.  
  41.     return self;
  42. }
  43.  
  44. - newViewSize 
  45. {
  46.     [fishList makeObjectsPerform:@selector(viewDidResize)];
  47.     return self;
  48. }
  49.  
  50. - (const char *)windowTitle
  51. {
  52.     return "Fish Are So Damn Relaxing";
  53. }
  54.  
  55. - didLockFocus
  56. {
  57.     return self;
  58. }
  59.  
  60. - sizeTo:(NXCoord)width :(NXCoord)height
  61. {
  62.     [super sizeTo:width :height];
  63.     [self newViewSize];
  64.     return self;
  65. }
  66.  
  67. - (BOOL)useBufferedWindow
  68. {
  69.     return NO;
  70. }
  71.  
  72. #ifdef NS3x
  73. -inspector:sender
  74. {
  75.     char buf[MAXPATHLEN];
  76.  
  77.     if (!sharedInspectorPanel) {
  78.         sprintf(buf,"%s/AquariumView.nib",[sender moduleDirectory:"Aquarium"]);
  79.                 [NXApp loadNibFile:buf owner:self withNames:NO];
  80.     }
  81.     return sharedInspectorPanel;
  82. }
  83. #endif
  84.  
  85. @end
  86.